<template>
  <router-link :to="`/shop/detail/${data.Id}`" class='__goods-item'>
    <div class='goods-head'>
      <img class='goods-logo' :src='data.Icon' />
      <div class='goods-name'>{{data.Name}}</div>
      <div class='goods-spec'>
        <div class='goods-comment'>
          <Rate :size="14" v-model="data.star" disabled disabled-color="#feaa0c" />
        </div>
        <div class='goods-score'>{{data.Score}}</div>
        <div class='goods-num'>月销{{data.SaleCount || 0}}单</div>
      </div>
      <div class='goods-info'>
        <div class='goods-reduce'>
          <div><i class="member-tip">会员专享</i><span>{{data.Manjian}}</span></div>
        </div>
        <div class='goods-distance'>
          <div>{{data.Distance}}m</div>
        </div>
      </div>
    </div>
    <div class='goods-gallery'>
      <div class='goods-gallery-item' v-for="(goods, index) in data.Goods" :key="index" >
        <img :src='goods.Image' />
        <div class='goods-gallery-name'>{{goods.Name}}</div>
        <div class='goods-gallery-price'>
          ¥<div class='goods-price-now'>{{goods.Price}}</div>
        </div>
      </div>
    </div>
  </router-link>
</template>
<script>
import { Rate } from 'vant';
export default {
  components: {
    Rate
  },
  props: {
    data: {
      type: Object,
      default() {
        return {}
      }
    }
  }
}
</script>
<style lang="less" scoped>
.__goods-item {
  .border-top(#e7e7e7);
  background: #fff;
  padding: 0 20px;
  display: block;
  .van-rate__icon{
    vertical-align: text-top;
  }
}

.goods-head {
  position: relative;
  padding: 20px 0 20px 140px;
  height: 120px;
}

.goods-logo {
  position: absolute;
  width: 120px;
  height: 120px;
  top: 20px;
  left: 0;
  border: 2px solid #e7e7e7;
}

.goods-name {
  font-size: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 8px;
  text-align: left;
}
.goods-reduce{
  & > div{
    display: flex;
    align-items: center;
  }
  span{
    display: inline-block;
    width: 380px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
.goods-spec,
.goods-distance {
  display: flex;
  font-size: 26px;
  align-items: center;
  color: #666;
  line-height: 40px;
}

.goods-score {
  margin: 0 10px 0 4px;
  color: #feaa0c
}

.goods-info {
  display: flex;
  font-size: 26px;
  align-items: center;
  justify-content: space-between;
  color: #666;
  line-height: 40px;
}

.goods-time {
  color: #14a161;
  border-left: 1px solid #e7e7e7;
  padding-left: 6px;
  margin-left: 6px;
  line-height: 16px;
  height: 16px;
}

.goods-gallery {
  margin-right: -20px;
  overflow: hidden;
  padding: 10px 0 20px;
}

.goods-gallery-item {
  float: left;
  width: calc(33.33333% - 24px);
  margin-right: 20px;
  border: 2px solid #e7e7e7;
  font-size: 0;
  padding-bottom: 10px;
  img{
    height: 220px;
  }
}

.goods-gallery-data img {
  width: 100%;
}

.goods-gallery-name {
  font-size: 26px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 10px;
  line-height: 42px;
  margin-top: 6px;
}

.goods-gallery-price {
  font-size: 22px;
  padding: 0 10px;
  line-height: 42px;
  display: flex;
  align-items: flex-end;
  color: #fe5339;
}

.goods-price-now {
  font-size: 32px;
  margin: 0 5px;
}

.goods-price-once {
  font-size: 22px;
  color: #999;
  text-decoration: line-through;
}
</style>
